package com.service.atf.reply.service;

import com.service.atf.base.model.Account;
import com.service.atf.base.model.TFGameExit;
import com.service.atf.reply.ac.AccountManager;
import com.service.atf.reply.core.IReadExecutor;

import java.util.Map;

/**
 * User: luotao
 * Date: 12-3-21
 * Time: 17:00:00
 */
public class GameExitService9 implements IReadExecutor<TFGameExit> {
    private static final String KEY_LAST_FLOW = "lastFlow";

    @Override
    public boolean isNotify() {
        return true;
    }

    public void initOut(Map out) {
        out.put(KEY_LAST_FLOW, 0);
    }

    @Override
    public void execute(boolean recover, AccountManager accountManager, TFGameExit gameExit, Map out) {
        //   Validata.validataCustomerCode(this, gameExit.getCustomerCode());
        Account account = AccountManager.getInstance().getBussAccount(gameExit.getCustomerCode());
        //   Validata.validataACNull(this, gameExit.getCustomerCode(), account);

        account.setRemainGameTime(Math.min(0, account.getRemainGameTime() -
                (account.getStartTime() - gameExit.getExitGameDate())));
        account.setStartTime(0);
        account.setBalcAward(account.getBalcAward() + account.getTmpAward());
        //����AC�˻���Ϣ
        AccountManager.getInstance().updateAccount(account);
    }
}
